/**
 * Copyright (C) 2015 Sankuai, Inc. All Rights Reserved.
 */
package com.lpc.framework.base.vo;

/**
 * @author jiangjinlong
 *
 */
public class AjaxCallBack {

    /**
     * 必选。状态码(ok = 200, error = 300, timeout = 301)，可以在BJUI.init时配置三个参数的默认值。
     */
    private Integer statusCode;
    /**
     * 可选。信息内容。
     */
    private String message = "操作成功!";
    /**
     * 可选。待刷新navtab id，多个id以英文逗号分隔开，当前的navtab id不需要填写，填写后可能会导致当前navtab重复刷新。
     */
    private String tabid;
    /**
     * 可选。待刷新dialog id，多个id以英文逗号分隔开，请不要填写当前的dialog id，要控制刷新当前dialog，请设置dialog中表单的reload参数。
     */
    private String dialogid;
    /**
     * 可选。待刷新div id，多个id以英文逗号分隔开，请不要填写当前的div id，要控制刷新当前div，请设置该div中表单的reload参数。
     */
    private String divid;
    /**
     * 可选。是否关闭当前窗口(navtab或dialog)。
     */
    private boolean closeCurrent = true;
    /**
     * 可选。跳转到某个url。
     */
    private String forward;
    /**
     * 可选。跳转url前的确认提示信息。
     */
    private String forwardConfirm;

    public static AjaxCallBack newInstance() {
        return new AjaxCallBack();
    }

    public AjaxCallBack success() {
        this.statusCode = 200;
        return this;
    }

    public AjaxCallBack fail() {
        this.statusCode = 300;
        this.closeCurrent = false;
        return this;
    }

    public AjaxCallBack timeout() {
        this.statusCode = 301;
        this.closeCurrent = false;
        return this;
    }

    public AjaxCallBack message(String message) {
        this.message = message;
        return this;
    }

    public AjaxCallBack tabid(String tabid) {
        this.tabid = tabid;
        return this;
    }

    public AjaxCallBack dialogid(String dialogid) {
        this.dialogid = dialogid;
        return this;
    }

    public AjaxCallBack divid(String divid) {
        this.divid = divid;
        return this;
    }

    public AjaxCallBack closeCurrent(boolean closeCurrent) {
        this.closeCurrent = closeCurrent;
        return this;
    }

    public AjaxCallBack forward(String forward) {
        this.forward = forward;
        return this;
    }

    public AjaxCallBack forwardConfirm(String forwardConfirm) {
        this.forwardConfirm = forwardConfirm;
        return this;
    }

    /**
     * @return the statusCode
     */
    public Integer getStatusCode() {
        return statusCode;
    }

    /**
     * @param statusCode the statusCode to set
     */
    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * @return the tabid
     */
    public String getTabid() {
        return tabid;
    }

    /**
     * @param tabid the tabid to set
     */
    public void setTabid(String tabid) {
        this.tabid = tabid;
    }

    /**
     * @return the dialogid
     */
    public String getDialogid() {
        return dialogid;
    }

    /**
     * @param dialogid the dialogid to set
     */
    public void setDialogid(String dialogid) {
        this.dialogid = dialogid;
    }

    /**
     * @return the divid
     */
    public String getDivid() {
        return divid;
    }

    /**
     * @param divid the divid to set
     */
    public void setDivid(String divid) {
        this.divid = divid;
    }

    /**
     * @return the closeCurrent
     */
    public boolean isCloseCurrent() {
        return closeCurrent;
    }

    /**
     * @param closeCurrent the closeCurrent to set
     */
    public void setCloseCurrent(boolean closeCurrent) {
        this.closeCurrent = closeCurrent;
    }

    /**
     * @return the forward
     */
    public String getForward() {
        return forward;
    }

    /**
     * @param forward the forward to set
     */
    public void setForward(String forward) {
        this.forward = forward;
    }

    /**
     * @return the forwardConfirm
     */
    public String getForwardConfirm() {
        return forwardConfirm;
    }

    /**
     * @param forwardConfirm the forwardConfirm to set
     */
    public void setForwardConfirm(String forwardConfirm) {
        this.forwardConfirm = forwardConfirm;
    }

}
